/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.example;


import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

/**
 * <p>Project: javaseapp - Demo
 * <p>Powered by webrx On 2021-07-28 09:10:15
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Demo {
    public static void main(String[] args) {
        //系统时间戳
        long t1 = System.currentTimeMillis();
        //java.util.Date
        Date t2 = new Date();
        //java.util.Calendar
        var t3 = Calendar.getInstance();
        //java8 新增的日期时间API printf() String.format() %tc不支持 LocalDateTime
        LocalDateTime t4 = LocalDateTime.now();
        System.out.printf("%tc%n", t1);
        System.out.printf("%tc%n", t2);
        System.out.printf("%tc%n", t3);
        System.out.printf("%tF%n", t3);
        System.out.printf("%tT%n", t3);
        System.out.printf("%tr%n", t3);
        System.out.printf("%1$tF %1$tT%n", t3);
        System.out.printf("%1$tY年%1$tm月%1$td日 %1$tT %1$tA\n",t2);

        //设置新的日期内容
        t3.set(1, 1985);
        t3.set(Calendar.MONTH,6-1);
        t3.set(5,9);
        t3.set(Calendar.HOUR_OF_DAY,11);
        t3.set(Calendar.MINUTE,20);
        t3.set(Calendar.SECOND,55);
        System.out.printf("%1$tY年%1$tm月%1$td日 %1$tT %1$tA\n",t3);

    }
}
